_Pragma("once");

#include <functional>
#include <cstring>


#define TASKCALLBACK __cdecl


template<class FUNCTION>
struct CallableInfo
{
    typedef FUNCTION Function;


    CallableInfo()
    {
        std::memset(this, 0, sizeof (*this));
    }


    CallableInfo(const Function& fn, void* const opaque) : function(fn)
    {
//        this->function = function;
        this->opaque = opaque;
    }


    Function& getFunction()
    {
        return function;
    }


    void setFunction(const Function& function)
    {
        this->function = function;
    }


    void* getOpaque()
    {
        return opaque;
    }


    void setOpaque(void* const opaque)
    {
        this->opaque = opaque;
    }


private:
    FUNCTION function;
    void* opaque;
};


typedef  std::function<void (void* opaque)> task_routine_t;
typedef CallableInfo<task_routine_t> TaskletInfo;


